<?php $this->load->view('left'); ?>
<script language="JavaScript" type="text/javascript" src="js/date.js"></script>
<script type="text/javascript">
        function check()
        {
                if($("#prod_id").val()=="")
                {
                        $("#prod_id").focus();
                        return false;
                }
                else
                {
                        var result=document.getElementById("notice").innerHTML;
                        if(result.indexOf("Ok")==-1){
                                return false;
                        }else{
                                return true;
                        }
                }
         }
         function createQueryString()
         {
                        var id=encodeURI($("#tree1").val());
                        //alert(id);
                        var querystring={cid:id};
                        return  querystring;
                }
         function second_cate()
         {
                $.ajax({
                        type:"post",
                        url:"second_cate.php",
                        data:createQueryString(),
                        success:function(data){
                                //  alert(decodeURI(data));
                                $("#tree2").html(decodeURI(data));
                                }
                        });
        }
   function check_pid()
   {
           if($("#prod_id").val()!=""){
                        $.ajax({
                        type:"post",
                        url:"check_pid.php",
                        data:createString(),
                        success:function(data){
                                        $("#notice").html(decodeURI(data));
                                }
                                });
                        }else{
                                $("#notice").html("<font color=\"red\">App Store Id can't null!</font>");
                                $("#prod_id").focus();
                                return false;
                                }
           }
        function createString()
        {
                        var pid=encodeURI($("#prod_id").val());
                        //alert(id);
                        var querystring={pid:pid};
                        return  querystring;
                }
   function check_isbn()
   {
           if($("#isbn").val()!=""){
                        $.ajax({
                        type:"post",
                        url:"check_isbn.php",
                        data:createStr(),
                        success:function(data){
                                        $("#notice").html(decodeURI(data));
                                }
                                });
                        }else{
                                $("#notice").html("<font color=\"red\">ISBN can't null!</font>");
                                $("#isbn").focus();
                                return false;
                                }
           }
   function createStr()
        {
                        var isbn=encodeURI($("#isbn").val());
                        //alert(id);
                        var querystring={isbn:isbn};
                        return  querystring;
                }
</script>
<h2>UpLoad PDF Books</h2>
<br />
<br />
<br />
<br />
<p id="notice"></p>
<form action="<?php echo site_url('manage/upload_setp_one')?>" name="form1" method="post" enctype="multipart/form-data">
        <table>
          <tr><td>Book Type:</td><td>
           <?php if ($sid > 0) { ?>
                                 Sub Book of:<?php echo $se_name ?>
                                 <input type="hidden" name="sid" id="sid" value="<?php echo $sid ?>" />
                                 <?php } else { ?>
           系列:<input type="radio" name="sid" id="sid" value="0"/>
           单本:<input type="radio" name="sid" id="sid" value="-1" checked="checked" />
                   <?php } ?>
              </td></tr>
              <?php if ($sid <= 0) { ?>
                <tr><td>App Store Id:</td><td><input type="text" name="prod_id" id="prod_id" onblur="return check_pid()"/></td></tr>
                                <?php } ?>
                <tr><td>ISBN:</td><td ><input type="text" name="isbn" id="isbn" onblur="return check_isbn()"/></td></tr>
                <tr><td>Book Name:</td><td ><input type="text" name="name" id="name" /></td></tr>
                <tr><td>Author:</td><td ><input type="text" name="author" id="author" /></td></tr>
           <?php if ($sid > 0) { ?>
                                 <input type="hidden" name="publisher" id="publisher" value="no input value "/>
                                 <input type="hidden" name="price" id="price" value="0.00"/>
                                 <input type="hidden" name="YYYY" id="YYYY" value="1986"/>
                                 <input type="hidden" name="MM" id="MM" value="10"/>
                                 <input type="hidden" name="DD" id="DD" value="15"/>
                                 <?php } else { ?>
                <tr><td>Publisher:</td><td ><input type="text" name="publisher" id="publisher" /></td></tr>
                <tr><td>Price:</td><td ><input type="text" name="price" id="price" value="0.99"/></td></tr>
                <tr><td>Publish Time:</td>
                <td >

                <select name=YYYY onchange="YYYYDD(this.value)">
                <option value="">--Year--</option>
                </select>
                <select name=MM onchange="MMDD(this.value)">
                <option value="">--Month--</option>
                </select>
                <select name=DD>
                <option value="">--Day--</option>
                </select>

                </td></tr>
                   <?php } ?>
                <tr><td>Book Description:</td><td ><textarea name="describe" rows="15" cols="90" ></textarea></td></tr>
           <?php if ($sid <=0) { ?>
                <tr>
                        <td>Select Category:</td>
                        <td >
                        <select name="tree1" id="tree1" onchange="return second_cate()" style="width:200px;">
                                <option value=''>Select First Categoty</option>
                                <?php foreach ($cate as $msg):?>
                                        <?php echo "<option  value=\"".$msg['classify_id']."\" />".$msg['type']."</option>";?>
                                <?php endforeach;?>
                        </select>
                        <select name="tree2[]" id="tree2" multiple="multiple" style="width:200px;">
                        <option>Select Second Categoty</option>
                        </select>
                        </td>
                </tr>
                <tr>
                <td>Recommand:</td>
                <td >
                        <input type="radio" name="star" value="5" /> Recommanded
                                 <input type="radio" name="star" value="4" checked="checked"/> Not Recommanded
                </tr>
                                 <?php } ?>
                <tr><td><input type="submit" name="submit" id="submit" value="submit" onclick="return check()" /></td><td ><input type="reset" name="reset" id="reset" value="reset"/></td></tr>
        </table>

</form>
<?php $this->load->view('right'); ?>
